<?php

echo "<html><head><title>Matos Info</title></head><body>";

echo "<h1>Liste du matos a acheter :</h1><br /><br />";
echo "<form method='POST' action='index.php?'>";
$f = unserialize(file_get_contents("matos"));

if (isset($_POST['add']))
  $f[] = $_POST['add'];

if (isset($_GET['del']))
  unset($f[$_GET['del']]);

$fp = fopen("matos", 'w+') or die("Error opening document");

fwrite($fp, serialize($f));
fclose($fp);

echo "Add item to buy : <input type=text name='add' value='' /><input type='submit' name='bite' value='add' /><br /><br />";
echo "Needed items : <br />";

echo "<table border=1>";

foreach ($f as $i => $d)
echo "<tr><td><a href='index.php?del=" . $i . "'>X</a></td><td width='700'>" . $d . "</td></tr>";

echo "</table>";
echo "</form>";
echo "<br /><hr>2011 - Service Info PCF</body></html>";

?>